From: Florian Müllner Date: Sat, 14 Sep 2019 12:41:08 +0000 (+0200) Subject: volume: Show indicator when microphone is active X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~540 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=6cad2511876e716ab26d94dccfa5c3de173c68ae;p=gnome-shell.git volume: Show indicator when microphone is active Devices like cameras and microphones are privacy sensitive, as they can be used to spy on the user. We cannot prevent non-sandboxed apps from doing that, but as we already track when the microphone is recording, we can at least show an indicator to make sure it doesn't happen behind the user's back. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/729 --- diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js index db8e5a1f1..3d23044da 100644 --- a/js/ui/status/volume.js +++ b/js/ui/status/volume.js @@ -299,6 +299,9 @@ var VolumeMenu = class extends PopupMenu.PopupMenuSection { this.addMenuItem(this._output.item); this._input = new InputStreamSlider(this._control); + this._input.item.connect('notify::visible', () => { + this.emit('input-visible-changed'); + }); this.addMenuItem(this._input.item); this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); @@ -338,6 +341,10 @@ var VolumeMenu = class extends PopupMenu.PopupMenuSection { getMaxLevel() { return this._output.getMaxLevel(); } + + getInputVisible() { + return this._input.item.visible; + } }; var Indicator = class extends PanelMenu.SystemIndicator { @@ -345,18 +352,24 @@ var Indicator = class extends PanelMenu.SystemIndicator { super(); this._primaryIndicator = this._addIndicator(); + this._inputIndicator = this._addIndicator(); this._control = getMixerControl(); this._volumeMenu = new VolumeMenu(this._control); this._volumeMenu.connect('icon-changed', () => { let icon = this._volumeMenu.getIcon(); - if (icon != null) { - this.indicators.show(); + if (icon != null) this._primaryIndicator.icon_name = icon; - } else { - this.indicators.hide(); - } + this._primaryIndicator.visible = icon !== null; + }); + + this._inputIndicator.set({ + icon_name: 'audio-input-microphone-symbolic', + visible: this._volumeMenu.getInputVisible(), + }); + this._volumeMenu.connect('input-visible-changed', () => { + this._inputIndicator.visible = this._volumeMenu.getInputVisible(); }); this.menu.addMenuItem(this._volumeMenu);